package com.gitee.yanfanvip.cluster;

import java.io.InputStream;
import java.io.OutputStream;

import org.jgroups.Address;
import org.jgroups.Message;
import org.jgroups.Receiver;
import org.jgroups.View;
import org.jgroups.util.MessageBatch;

public interface ClusterReceiver extends Receiver{
	public default void receive(Message msg) { }

    public default void receive(MessageBatch batch) {
        for(Message msg: batch) {
            try { receive(msg); } catch(Throwable t) { }
        }
    }

    public default void getState(OutputStream output) throws Exception { }

    public default void setState(InputStream input) throws Exception { }

    public default void viewAccepted(View view) { }

    public default void suspect(Address mbr) { }

    public default void block() { }

    public default void unblock() { }
}
